<!DOCTYPE html>
<html lang="zh-Hans-CN">
<head>
    <meta charset="UTF-8">
    <title>事件监听：按键修饰符</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../vue.js"></script>
</head>
<body>
<h2>【例19】事件监听：按键修饰符keyup.enter/shift/space/up/down/left/right</h2>
<hr>
<div id="app">
    输入信息按下回车,空格：space,shift,Down等键，观察控制台输出
    <input type="text" v-on:keyup.enter="submit"
           v-on:keyup.shift="shift"
           v-on:keyup.space="space"
           v-on:keyup.down="down"
           v-on:keyup.up="up"
           v-on:keyup.left="left"
           v-on:keyup.right="right">
</div>
<script>
    let vm = new Vue({
        el: '#app',
        methods: {
            submit() {
                console.log('按下回车键')
            },
            shift() {
                console.log('按下shift键')
            },
            space() {
                console.log('按下space键')
            },
            down() {
                console.log('按下down键')
            },
            up() {
                console.log('按下up键')
            },
            left() {
                console.log('按下 左 键')
            },
            right() {
                console.log('按下 右 键')
            }

        }
    })
</script>
<hr>
<p><a href="index.html">返回章节目录</a>
    <script>document.write(document.lastModified); </script>
</p>
</body>
</html>
